<html>
<head>
    <css file="__PUBLIC__/css/body.css"/>
    <css file="__PUBLIC__/css/content.css"/>
    <css file="__STATIC__/icon/icon.css"/>
    <js file="__STATIC__/jquery-1.7.2.min.js"/>
    <css file="__STATIC__/kindeditor/themes/default/default.css" />
    <js file="__STATIC__/kindeditor/kindeditor-min.js"/>
    <js file="__STATIC__/kindeditor/lang/zh_CN.js"/>
    <css file="__STATIC__/uploadify/uploadify.css"/>
    <js file="__STATIC__/uploadify/jquery.uploadify.js"/>
    <js file="__STATIC__/My97DatePicker/WdatePicker.js"/>
    
    <script type="text/javascript">
        $(function(){
                var url1="{:U('Upload/upload_ke_json','',0)}";
                var url2="{:U('Upload/upload_ke_manager','',0)}";
                var editor;
    			KindEditor.ready(function(K) {
    				editor = K.create('.elem1', {
                        uploadJson : url1,
                        fileManagerJson : url2,
                        allowFileManager : true
    				});
    			});
        });  
        function gotopage(page){
            window.location="{:U('Content/add',array('tag'=>$module['tag']),0)}/cid/"+page;
        }                        
    </script>
    <style type="text/css">
        .attr input,.attr span{float:left;font-weight: normal;border:0px;background:#f8f8f8;}
        .attr span{height:30px;line-height:30px;}
    </style>
</head>
<body>
<form action="{:U('Content/addhandle')}" method='post'>
    <div class="top">
        <div class="position"><span class="icon icon-31"></span>当前位置：添加{$module.title}</div>
        <div class="top-title">
            <span class="icon icon-32"></span>
            <div class="top-tool">
                <a class="button-a" href="{:U('Content/index',array('tag'=>$module['tag']))}">返回列表</a>
                <input class="button-b" type="submit" value="提交保存"/>
                <input type="hidden" name="tag" value="{$module.tag}"/>
            </div>
        </div>
    </div>
    <div class="body">
       <div class="row" style="">
            <div class="col col1">分类：</div>
            <div class="col col2">
                <select name="cid" style="margin-top: 5px;" onchange="gotopage(this.options[this.selectedIndex].value)">
                          <option value ="0">选择分类</option>
                          <foreach name="category" item="v">
                             <option value ="{$v['id']}"  <if condition="$mcategory eq $v['id']">selected=""</if>>{$v['title']}</option>
                          </foreach>
                </select>
                <span class="remark">必需先选择分类！</span>
            </div>
            <div style="clear: both;"></div>
       </div>
       <if condition="$fields">
           <div class="row">
                <div class="col col1">访问权限：</div>
                <div class="col col2"> 
                    <select name="access" style="margin-top: 5px;">
                        <option value="0">继承分类</option>
                        <option value="1">游客</option>
                        <option value="2">会员</option>
                        <option value="3">禁止访问</option>
                    </select>
                    <span class="remark">设为"继承分类"将会继承分类的权限</span>
                </div>
                <div style="clear: both;"></div>
           </div>
           <div class="row">
                <div class="col col1">评论权限：</div>
                <div class="col col2">
                    <select name="review" style="margin-top: 5px;">
                        <option value="0">继承分类</option>
                        <option value="1">游客</option>
                        <option value="2">会员</option>
                        <option value="3">禁止评论</option>
                    </select>
                    <span class="remark">设为"继承分类"将会继承分类的权限</span>
                </div>
                <div style="clear: both;"></div>
           </div>
       </if>
       <foreach name="fields" item="v">
                <if condition="$v.ftype eq 1">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <input type="text" name="{$v.tag}"/>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 2">
                    <div style="font-size: 12px;height:305px;padding:2px 0px;border-bottom:1px solid #dcdcdc;">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2" style="text-align: left;">
                            <textarea class="elem1" style="width:700px;height:300px;" name="{$v.tag}"></textarea>
                        </div>
                    </div>
                </if>
                <if condition="$v.ftype eq 3">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <input type="text" name="{$v.tag}"/>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 4">
                     <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <script>
                                $(function() {
                                	$("#{$v.tag}_s").uploadify({
                                		height        : 22,
                                		swf           : '__STATIC__/uploadify/uploadify.swf',
                                		uploader      : '{:U("Upload/upload_tp")}',
                                		width         : 60,
                                        multi         :false, //ture多文件，false单文件
                                        queueID:'uploadify_ppt',
                                        buttonText:'',
                                        removeCompleted : true,
                                        'onUploadSuccess':function(file,data,response){
                                                if(data=='error') 
                                                {
                                                    alert('上传出错，请检查原因!(文件大小/文件类型)');
                                                }
                                                else
                                                {
                                                    $('#{$v.tag}').val(data);
                                                }
                                        }
                                	});
                                });
                            </script>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td><input style="margin: 0px;margin-top:2px;" type="text" name="{$v.tag}" id="{$v.tag}"/></td>
                                    <td style="padding-top: 3px;padding-left:3px;"><input type="file" name="{$v.tag}_s" id="{$v.tag}_s"/></td>
                                    <td><div id="uploadify_ppt" style="width:400px;margin-left:5px;"></div></td>
                                </tr>
                            </table>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 5">
                   
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2">
                            <script>
                            $(function() {
                            	$("#file_upload_1").uploadify({
                            		height        : 22,
                            		swf           : '__STATIC__/uploadify/uploadify.swf',
                            		uploader      : '{:U("Upload/upload_tp")}',
                            		width         : 60,
                                    multi         :true, //ture多文件，false单文件
                                    queueID:'',
                                    buttonText:'',
                                    removeCompleted : true,
                                    queueID:'uploadify_ppts',
                                    'onUploadSuccess':function(file,data,response){
                                            if(data=='error') 
                                            {
                                                    alert('有部分文件上传出错，请检查原因!(文件大小/文件类型)');
                                            }
                                            else
                                            {
                                                $('#refile_v_v').val($('#refile_v_v').val()+data+'`');
                                                $('#refiles_s_s').append("<a target='_blank' href='"+data+"'><img width='30' height='30' style='margin-left:1px;border:0px;' src='"+data+"'/></a>");
                                            }
                                    }
                            	});
                            });
                            </script>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td style="padding-top:3px;margin-left:3px;">
                                        <input type="file" name="file_upload_1" id="file_upload_1"/>
                                        <input type="hidden" id="refile_v_v" name="refile"/>
                                        <div id="uploadify_ppts" style="display:none;"></div>
                                    </td>
                                    <td><div style="height: 30px;margin-left:5px;" id="refiles_s_s"></div></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </if>
                <if condition="$v.ftype eq 6">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <input type="text" name="{$v.tag}" readOnly="true"  class="Wdate" onclick="WdatePicker()"/>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 7">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2">
                                <input style="float: left;" type='checkbox' name='{$v.tag}' value="1"/>
                                <span style="float: left;">{$v.title}</span>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 8">
                    <div style="border-bottom:1px solid #dcdcdc;">
                        <div class="col col1" style="font-size: 12px;">{$v.title}：</div>
                        <div>
                                <textarea style="float:left;margin:4px 0px;" name="{$v.tag}"></textarea>
                                <div style="clear: both;"></div>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
            </foreach>
    </div>
    
</form>
</body>
</html>